﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using MVVM_CAD.Algorithms;
using MVVM_CAD.Common;
using MVVM_CAD.Model;

namespace MVVM_CAD.Strategy
{
    public class CircleToolStrategy : StrategyBase
    {
        public CircleToolStrategy(IFigure figure)
            : base(figure)
        {
        }

        public override IFigure PerformMouseLeftClicDownEvent(Canvas canvas, IPoint point, IEnumerable<IFigure> figures)
        {
            ClickCount++;
            if (ClickCount < 2)
            {
                ValidateFigureIsNew<Circle>();
                Figure.PointsCollection.Add(point);
                return Figure;
            }

            var circleRepresentation = BressenhamCircle.GetCircleRepresentation(Figure.InitialPoint, point);

            foreach (var points in circleRepresentation)
                Figure.PointsCollection.Add(points);

            FigureDrawer.DrawFigure(canvas, Figure);
            CloseFigureDrawing();

            return Figure;
        }

        public override IFigure PerformMouseLeftClicUpEvent(Canvas canvas, IPoint point, IEnumerable<IFigure> figures)
        {
            throw new NotImplementedException();
        }

        public override IFigure PerformMouseRightClicDownEvent(Canvas canvas, IPoint point, IEnumerable<IFigure> figures)
        {
            throw new NotImplementedException();
        }

        public override IFigure PerformMouseMoveEvent(IPoint point, IEnumerable<IFigure> figures)
        {
            throw new NotImplementedException();
        }

        public override IFigure PerformMouseMoveEvent(DrawingCanvas Canvas, CustomPoint point)
        {
            throw new NotImplementedException();
        }
    }
}
